package com.lyy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lyy.entity.Order;
import com.lyy.mapper.OrderMapper;
import com.lyy.service.OrderService;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * @author Liangyaoyun
 */
@Data
public
class OrderServiceImpl implements OrderService {
    private OrderMapper orderMapper;
    @Override
    public int insertByOrderId(Order order) {
        return orderMapper.insertByOrderId(order);
    }

    @Override
    public int updateByOrderId(Order order) {
        return orderMapper.updateByOrderId(order);
    }

    @Override
    public int deleteByOrderId(Integer orderId) {
        return orderMapper.deleteByOrderId(orderId);
    }

    @Override
    public int deleteByOrderIds(List<Integer> orderId) {
        return orderMapper.deleteByOrderIds(orderId);
    }

    @Override
    public Order selectByOrderId(Integer orderId) {
        return orderMapper.selectByOrderId(orderId);
    }

    @Override
    public List<Order> selectAllOrder() {
        return orderMapper.selectAllOrder();
    }

    @Override
    public PageInfo<Order> selectBypage(Integer pageNumber, Integer pageSize) {
        PageHelper.startPage(pageNumber,pageSize);
        return new PageInfo<>(orderMapper.selectAllOrder());
    }
    @Override
    public int todayCount() {
        return orderMapper.todayCount();
    }
    @Override
    public int totalCount() {
        return orderMapper.totalCount();
    }
    @Override
    public List<Map<String, Integer>> growthCount(){
        return orderMapper.growthCount();
    }
}
